.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "CSV2SQL" 1 "2022-07-09" "0.1" "SlackBuilds.org"
.SH NAME
csv2sql \- import data from CSV files into an SQLite database
.\" RST source for csv2sql(1) man page. Convert with:
.
.\" rst2man.py csv2sql.rst > csv2sql.1
.
.\" rst2man.py comes from the SBo development/docutils package.
.
.SH SYNOPSIS
.sp
csv2sql [\fB\-d\fP | \fB\-\-database\fP  \fIdatabase\fP] [\fB\-e\fP | \fB\-\-encoding\fP \fIencoding\fP \fIINPUT\fP:\fIOUTPUT\fP] [\fB\-f\fP | \fB\-\-file\fP \fIfilename\fP] [\fB\-h\fP | \fB\-\-help\fP] [\fB\-t\fP | \fB\-table\fP \fItable\fP] [\fB\-v\fP | \fB\-\-verbose\fP] [\fB\-V\fP | \fB\-\-version\fP]
.SH DESCRIPTION
.sp
\fBcsv2sql\fP is a Ruby script for importing comma\-separated value files
into SQLite.
.sp
The destination table and database will automatically be created if
they do not already exist.
.sp
If the destination table already exists, then \fBcsv2sql\fP assumes that
it contains the same number of columns as the input data. The column
names do not need to match.
.SH OPTIONS
.INDENT 0.0
.TP
.BI \-d\fP,\fB  \-\-database \ DATABASE
Database to import into. Default is \fIcsv2sql.db\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.B \-e, \-\-encoding INPUT:OUTPUT
Input and output encodings. Default is \fIUTF\-8:UTF\-8\fP\&.
.UNINDENT
.INDENT 0.0
.TP
.BI \-f\fP,\fB  \-\-file \ FILENAME
CSV file to import. You can alternately read CSV data from standard input.
.TP
.B  \-h\fP,\fB  \-\-help
Print built\-in help message and exit.
.TP
.BI \-t\fP,\fB  \-\-table \ TABLE
Table to import into. Default is the name of the file being imported from or \fIstdin\fP if CSV data is from standard input. Periods in the filename are replaced with underscores.
.TP
.B  \-v\fP,\fB  \-\-verbose
Print verbose output.
.TP
.B  \-V\fP,\fB  \-\-version
Print version number and exit.
.UNINDENT
.SH NOTE
.sp
\fBcsv2sql\fP assumes the first line of CSV data is a header giving the
column names. If your CSV file doesn\(aqt have column names (if the first
line is just CSV data), you\(aqll have to edit it and add the column
names for \fBcsv2sql\fP to work correctly with it.
.SH EXAMPLES
.INDENT 0.0
.IP 1. 3
Import widgets.csv into the default table (widgets_csv) and database (csv2sql.db):
.INDENT 3.0
.INDENT 3.5
.sp
.nf
.ft C
csv2sql \-f widgets.csv
.ft P
.fi
.UNINDENT
.UNINDENT
.IP 2. 3
Import standard input into the "foo" table within the "bar.db" database:
.INDENT 3.0
.INDENT 3.5
.sp
.nf
.ft C
cat widgets.csv | csv2sql \-t foo \-d bar.db
.ft P
.fi
.UNINDENT
.UNINDENT
.IP 3. 3
Import products.csv and more\-products.csv into the "products" table within the default database (csv2sql.db):
.INDENT 3.0
.INDENT 3.5
.sp
.nf
.ft C
csv2sql \-f products.csv \-t products
csv2sql \-f more\-products.csv \-t products
.ft P
.fi
.UNINDENT
.UNINDENT
.IP 4. 3
Export data from SQLite sorted by the "ProductName" column to output.csv:
.INDENT 3.0
.INDENT 3.5
.sp
.nf
.ft C
sqlite3 \-header \-csv csv2sql.db "SELECT * FROM products ORDER BY ProductName" > output.csv
.ft P
.fi
.UNINDENT
.UNINDENT
.UNINDENT
.SH COPYRIGHT
.sp
\fBcsv2sql\fP is open source software released under the MIT License. See:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
http://www.opensource.org/licenses/MIT
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHORS
.sp
\fBcsv2sql\fP was written by Matt Rideout.
.sp
This man page written for the SlackBuilds.org project
by B. Watson, and is licensed under the WTFPL.
.SH SEE ALSO
.sp
The csv2sql homepage: \fI\%http://csv2sql.org/\fP
.\" Generated by docutils manpage writer.
.
